import 'package:bitcatflutter/widget/text_page.dart';
import 'package:flutter/material.dart';

class BasicWidgetPage extends StatelessWidget {
  const BasicWidgetPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("基础组件"),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: ListView(
          children: [
            ElevatedButton(onPressed: ()=> jumpPage(context, "/text"), child: Text('Text')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/image"), child: Text('image')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/button"), child: Text('Button')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/textfield"), child: Text('textField')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/form"), child: Text('form')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/switch"), child: Text('switch checkbox Radio')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/container"), child: Text('container')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/listview"), child: Text('ListView')),
            ElevatedButton(onPressed: ()=> jumpPage(context, "/GridView"), child: Text('GridView')),
          ],
        ),
      ),
    );
  }

  jumpPage(BuildContext context,String url){
    Navigator.pushNamed(context, url);
    // Navigator.push(context, MaterialPageRoute(builder: (context)=> const TextPage()));
  }
}
